package com.easyse.serviceclient.clients;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author: zky
 * @date: 2022/10/15
 * @description:
 */
@FeignClient(value = "ossservice")
@RequestMapping("api/file")
public interface OssClient {

    /**
     * 文件上传api
     * @param file
     * @return
     */
    @PostMapping("upload")
    JSONObject upload(@RequestParam("file") MultipartFile file);

    /**
     * 文件下载api
     * @param fileName
     * @param response
     * @return
     */
    @GetMapping(value = "download/{fileName}")
    JSONObject download(@PathVariable("fileName") String fileName, HttpServletResponse response);

    /**
     * 文件删除api
     * @param fileName
     * @return
     */
    @GetMapping("/delete/{fileName}")
    JSONObject deleteFile(@PathVariable("fileName") String fileName);
}
